using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Mvc;
using Vin.Extension.Framework.Aop;
using Vin.Extension.Framework.Base;
using Vin.Extension.Framework.Monitor.Dto.List;
using Vin.Extension.Framework.Monitor.ServiceInterface;
using Vin.Tool.Attributes;

namespace Vin.Extension.Framework.Monitor.Controller.Controllers;

[Route("monitor/request-log")]
public class SysRequestLogController : VinFrameworkBaseController
{
    [Inject] private readonly ISysRequestLogService _sysRequestLogService = null!;

    [VinAuthorize("monitor:request-log:list"), HttpGet("list")]
    public async Task<IActionResult> List([FromQuery] SysRequestLogListDto dto)
    {
        return Success(await _sysRequestLogService.ListAsync(dto), dto.TotalCount);
    }

    [VinAuthorize("monitor:request-log:query"), HttpGet("query")]
    public async Task<IActionResult> Query([Required(ErrorMessage = "请求记录不能为空")] long id)
    {
        return Success(await _sysRequestLogService.QueryAsync(id));
    }
}